// 创建基地址
const BASEURL = 'https://www.uinav.com/api/public/v1/'
// 创建request实例对象
const request = ({
    url,
    data = {},
    method = 'GET',
    header = {},
    tip = '拼命加载中...'
}) => {
    return new Promise((resolve, reject) => {
        uni.showLoading({
            title: tip,
            mask: true
        })
        uni.request({
            url: `${BASEURL}${url}`,
            data,
            header,
            method,
            success: ({
                data,
                statusCode,
                header
            }) => {
                resolve(data)
            },
            fail: (error) => {
                reject(error)
            },
            complete: () => {
                uni.hideLoading()
            }
        })
    })
}
uni.$request=request